<div class="tnm-col-left">
	<h2 class="title-tnm-col-left">Sơ đồ bàn</h2>
    <!--div class="sort">
    	<input type="text" class="search" value="Nhập tên"/>
    </div-->
    <div class="content-tnm-col-left">
    	<table class="DataTable" cellpadding="0" cellspacing="0">
            <input type="hidden" id="hi-select-customer" />
            <form name="list-customers-form" id="list-customers-form" action="<?php echo Yii::app()->request->requestUri; ?>" method="post">
            <input type="hidden" id="hi-act-list-customers-form" name="hi-act-list-customers-form" value="" />
            <tr class="head">
                <td width="30" align="center"></td>
                <td width="180">Họ và Tên</td>
                <td width="100">Ngày sinh</td>
                <td width="*">Địa chỉ</td>
                <td width="100">Số điện thoại</td>
                <td width="100" align="center">Số lần đến</td>
                <td width="120" align="center">Lần gần nhất</td>
            </tr>
            <?php foreach ($dataCustomers->data as $index => $customer) : ?>
            <tr id="tr_customer_<?php echo $customer->id; ?>" class="<?php echo ($index%2==0)?'even':'odd'; ?>" id="tableRow_<?php echo $index; ?>" onmouseover="tableRowHover(this,1);" onmouseout="tableRowHover(this,0);" onclick="rowSelection(this);getAjaxCustomer('<?php echo $customer->id; ?>');$('#hi-select-customer').val('<?php echo $customer->id; ?>');">
                <td align="center"><input type="checkbox" name="Customers[]" value="<?php echo $customer->id; ?>" onClick="//Check(document.myform.check_list)"></td>
                <td><?php echo $customer->name; ?></td>
                <td><?php echo $customer->birthday; ?></td> 
                <td><?php echo $customer->adress; ?></td>
                <td><?php echo $customer->phone; ?></td> 
                <td><?php echo $customer->visit; ?></td>
                <td><?php echo $customer->recent; ?></td>
            </tr>
            <?php endforeach; ?>
            </form>
        </table> 
        <div class="paging">
            <?php $this->widget('CLinkPager', array(
                	'pages' => $dataCustomers->pagination,
                    'prevPageLabel'=>'&lt; Last',
                	'nextPageLabel'=>'Next &gt;',
                	'header'=>'',
                ));
            ?>
        </div>
        <div class="option">
            <ul>
                <!--li>
                    <a class="btn-customer" href="#">
                        <img src="images/icon-new.png" alt="" width="20" height="20" />
                        <div class="clear">Thêm mới</div>
                    </a>
                </li-->
                <!--li>
                    <a class="edit" href="#" onclick="getAjaxCustomer($('#hi-select-customer').val());return false;">
                        <img src="images/icon-edit.png" alt="" width="20" height="20" />
                        <div class="clear">Chỉnh sửa</div>
                    </a>
                </li-->
                <li>
                    <a class="delete" href="javascript:return confirm('Bạn muốn xóa ?');" onclick="$('#hi-act-list-customers-form').val('del');$('#list-customers-form').submit();return false;">
                        <img src="<?php echo Yii::app()->request->baseUrl;?>/images/icon-delete.png" alt="" width="20" height="20" />
                        <div class="clear">Xóa khách</div>
                    </a>
                </li>
                <li>
                    <a class="print" href="#" onclick="window.print();return false;">
                        <img src="<?php echo Yii::app()->request->baseUrl;?>/images/icon-print.jpg" alt="" width="20" height="20" />
                        <div class="clear">In trang</div>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    
    <div class="bottom-tnm-col-left"></div>
</div>
<div class="tnm-col-right">
	<h2 class="title-tnm-col-right">Quản lý</h2>
    <div class="content-tnm-col-right">
    	<div id="sub-col-right">
            <div id="edit_customer">
                <div class="sub-title">Thêm mới</div>
                <div class="dialog-new">
                    <?php $form=$this->beginWidget('CActiveForm', array(
                        	'id'=>'add-customer-form',
                        	'enableAjaxValidation'=>false,
                        )); ?>
                        <input type="hidden" id="hi-act-add-customer-form" name="hi-act-add-customer-form" value="add" />
                        <div class="style-form">
                            <dl>
                                <dt>Tên khách hàng:</dt>
                                <dd><?php echo $form->textField($modelCreate,'name'); ?></dd>
                                <dd><?php echo $form->error($modelCreate,'name'); ?></dd>
                            </dl>
                            <dl>
                                <dt>Địa chỉ:</dt>
                                <dd><?php echo $form->textField($modelCreate,'adress'); ?></dd>
                                <dd><?php echo $form->error($modelCreate,'adress'); ?></dd>                     
                            </dl>
                            <dl>
                                <dt>Số điện thoại:</dt>
                                <dd><?php echo $form->textField($modelCreate,'phone'); ?></dd>      
                                <dd><?php echo $form->error($modelCreate,'phone'); ?></dd>               
                            </dl>
                            <dl>
                                <dt>Ngày sinh:</dt>
                                <dd>
                                <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                                        'attribute'=>'birthday',
                                        'model'=>$modelCreate,
                                        'options'=>array('dateFormat'=>'dd/mm/yy'),
                                    ));?>
                                </dd> 
                                <dd><?php echo $form->error($modelCreate,'birthday'); ?></dd>                    
                            </dl>
                            <dl>
                                <dt></dt>
                                <dd>
                                    <div class="button" style="padding-top:20px; margin-left:80px; clear:both"><a href="#" onclick="$('#add-customer-form').submit();return false;">Tạo mới</a></div>
                					<!--div class="button" style="margin-left:5px"><a href="#" onclick="$( '.dialog-customer' ).dialog( 'close' );return false;">Hủy</a></div-->
                                </dd>                  
                            </dl>
                        </div>
                    <?php $this->endWidget(); ?>
                </div>
            </div>
        </div>
    </div>
    <div class="bottom-tnm-col-right"></div>
</div>
<script type="text/javascript">
    function getAjaxCustomer(customer_id)
    {
        if (typeof(customer_id) == 'undefined'|| !customer_id) return;
        $.ajax({
            type  : "GET",
            cache : false,
            url   : base_url + '/customer/edit/customer_id/' + customer_id,
            success: function(returnContent){
                $("#edit_customer").html(returnContent);
            }
        });
    }
</script>

<!-- ----------------Customer---------------------- -->
<div id="dialog-customer" class="dialog-customer" title="KHÁCH HÀNG">
	
</div>